//
//  AKLocalClient.h
//  AKLocalClient
//
//  Created by Yun Qing Teng on 11/13/06.
//  Copyright 2006 __MyCompanyName__. All rights reserved.
//

#import <Cocoa/Cocoa.h>
#define READ_BUFFER_SIZE 4096
#define MAX_BUFFER_SIZE 256

typedef struct UserInfo {
	char username[9];
	int fd;
	
	// what the length byt says we should get
	unsigned int currentMessageSize;
	
	// what we have read (not including length)
	int bytesRead;
	char buffer[READ_BUFFER_SIZE];
};

@interface AKLocalClient : NSObject {
	NSNetServiceBrowser * browser;
    NSMutableArray * services;
    NSNetService * serviceBeingResolved;
	struct UserInfo user;
	fd_set userfd;
	
	id delegate;
}

- (NSArray *)availableServices;
- (void)subscribeToService:(NSNetService *)aNetService;
- (void)unsubscribe;
- (void)sendMessage:(NSString *)aMessage;
- (void)sendNewMoveWithChessIndex:(unsigned)aIndex step:(unsigned)newStep;
- (void)setDelegate:(id)aDelegate;
@end
